<ui:composition template="/templates/main.xhtml"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:a4j="http://richfaces.org/a4j"
		xmlns:c="http://java.sun.com/jsp/jstl/core"
		xmlns:rich="http://richfaces.org/rich" >
		<ui:define name="body">
		<link rel="stylesheet" href="css/themes/redmond/jquery.ui.all.css" />
		<script src="js/ui/jquery.ui.position.js"></script>
		<script src="js/ui/jquery.ui.resizable.js"></script> 
		<script src="js/ui/jquery.ui.core.js"></script>
		<script src="js/ui/jquery.ui.widget.js"></script>
		<script src="js/ui/jquery.ui.dialog.js"></script>
		<script>
	$(function() {
		$( "#dialog" ).dialog({
			autoOpen: false,
			show: "blind",
			hide: "explode",
			width: 810,
			height: 500,
			modal: true
		});
	});
	</script>
		
<style>
	.tableStyle {
		width: 100%;	
	}
	.rf-dt-c{
	   text-align: center;
	}
	.rf-ds{
	   margin-top:10px;
	   margin-left:450px;
	}
</style>
	<rich:panel>
		<f:facet name="header">
			<h:outputText value="文档列表"/>
		</f:facet>
			<h:form>
			
			
			<div align="right" style="padding-right:20px">
					
					<a href="addDocument.jsf" style="cursor:pointer">
					<img height="18" width="18" src="images/icons/add.png" />
								<font size="2"><b>添加文件</b></font>
					</a>	
					<a href="addKnowledge.jsf" style="cursor:pointer">
					<img height="18" width="18" src="images/icons/add.png" />
								<font size="2"><b>添加资料</b></font>
					</a>	
					<a href="javascript:window.location.reload();" style="cursor:pointer">
					<img height="18" width="18" src="images/icons/Button_Refresh.png" />
								<font size="2"><b>刷新</b></font>
					</a>
			</div>
				
				<c:if test="#{showDateBean.row eq 0}">
					<div align="center">
						<img src="images/icons/broken.png" width="50" height="50"/><h1>您还未添加文档，请先添加文档！</h1>
					</div>
			   </c:if>	
				<c:if test="#{showDateBean.row != 0}">
				<rich:dataTable value="#{showDateBean.docList}" var="doc" id="table"
					rows="15" width="800" styleClass="tableStyle">
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="标  题" />
						</f:facet>

						<h:outputText value="#{doc.title}" />
					</rich:column>
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="作  者" />
						</f:facet>
						<h:outputText value="#{doc.author}" />
					</rich:column>
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="标  签" />
						</f:facet>
						<h:outputText value="#{doc.label}" style="width: 100px" />
					</rich:column>
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="类  别" />
						</f:facet>
						<h:outputText value="#{doc.classify}"
							style="height: 50px; width: 200px" />
					</rich:column>
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="主 题" />
						</f:facet>
						<h:outputText value="#{doc.themewords}"
							style="height: 50px; width: 200px" />
					</rich:column>
					<rich:column width="200">
						<f:facet name="header">
							<h:outputText value="关键字" />
						</f:facet>
						<h:outputText value="#{doc.keywords}"
							style="height: 50px; width: 200px" />
					</rich:column>
					<rich:column width="50px">
						<f:facet name="header">
							<h:outputText value="创建时间" />
						</f:facet>
						<h:outputText value="#{doc.createtime}">
							<f:convertDateTime pattern="yyyy年MM月dd日  HH:mm:ss"/>
						</h:outputText>
						
					</rich:column>
					<rich:column width="50px">
						<f:facet name="header">
							<h:outputText value="修改时间" />
						</f:facet>
						<h:outputText value="#{doc.edittime}">
							<f:convertDateTime pattern="yyyy年MM月dd日 hh:mm:ss"/>
						</h:outputText>
						
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="浏览" />
						</f:facet>
						<a onclick="$('#dialog').dialog( 'open' );" id="opener" href="ShowOne.jsf?id=#{doc.documentid}" target="info">
							<img height="20px" width="20px" src="images/icons/view.png" alt="查看" /> 
						</a>
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="修改" />
						</f:facet>
						<a onclick="$('#dialog').dialog( 'open' );" id="opener" href="modifyDocument.jsf?id=#{doc.documentid}" target="info">
							<img height="20px" width="20px" src="images/icons/editefile.png" alt="修改" /> 
						</a>
						
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="删除" />
						</f:facet>
						<a4j:commandLink render="table" action="#{documentBean.delDoucment}" onclick="return confirm('确定要删除文档吗？');">
							<img height="20px" width="20px" src="images/icons/delfile.png" alt="删除" />	
							<a4j:param name="documentid" value="#{doc.documentid}"
										assignTo="#{documentBean.documentid}" />
						</a4j:commandLink>
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="共享" />
						</f:facet>
						    <a4j:commandLink rendered="#{ 0 == doc.sharetg || '' == doc.sharetg || null == doc.sharetg}" render="table" action="#{documentBean.shareDoucment}" onclick="return confirm('确定要共享此文档吗？');">
							<img height="20px" width="20px" src="images/icons/calshare.ico" alt="共享" />	
							<a4j:param name="documentid" value="#{doc.documentid}"
										assignTo="#{documentBean.documentid}" />
						    </a4j:commandLink>
						
						<a4j:commandLink rendered="#{ 1 == doc.sharetg}" render="table" action="#{documentBean.calshareDoucment}" onclick="return confirm('确定要取消共享此文档吗？');">
							<img height="20px" width="20px" src="images/icons/share.ico" alt="取消共享" />	
							<a4j:param name="documentid" value="#{doc.documentid}"
										assignTo="#{documentBean.documentid}" />
						</a4j:commandLink>
						
					</rich:column>
					
				</rich:dataTable>
					<rich:dataScroller for="table" id="scp" align="right"
					renderIfSinglePage="true" maxPages="30"> 
					 <f:facet name="first">
                    <h:outputText value="first"/>
                     </f:facet>
                    <f:facet name="last">
                    <h:outputText value="last"/>
                     </f:facet>
                 </rich:dataScroller>
				</c:if>
	 
			</h:form>
	</rich:panel>	
		  	<div id="dialog" title="详细信息">	
				<iframe align="left"  frameborder="0" name="info" width="780px" height="450px;" />
			</div>
		</ui:define>
	</ui:composition>